#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	int n = 0;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		getchar();
		double m, f;
		char s;
		scanf("%c", &s);
		getchar();
		if (s == 'M') {
			scanf("%lf", &m);
			f = m / 1.09;
			printf("%.2lf\n", f);
		}
		if(s == 'F') {
			scanf("%lf", &f);
			m = f * 1.09;
			printf("%.2lf\n", m);
		}
	}
	return 0;
}